#ifndef _NODEEDITOR_H
#define _NODEEDITOR_H

#include <cassert>
#include <cstdlib>
#include <vector>
#include <string>
#include <iostream>

#include <gtkmm.h>

#include "reseatable_reference.h"

#include "utils.h"
#include "scenenode.h"

class NodeEditor
{
	public:
		// returns true if the node was changed
		bool editNode(SceneNode & node, const SceneNode & root);
		void updateEntryFromBrowse(Gtk::Entry * entry);
		
	private:
		
		typedef std::map <std::string, Gtk::Entry *> entryMap_type;
		entryMap_type entryMap;
		typedef std::map <std::string, Gtk::ComboBoxText *> dropdownMap_type;
		dropdownMap_type dropdownMap;
		typedef std::map <std::string, Gtk::CheckButton *> checkMap_type;
		checkMap_type checkMap;
		reseatable_reference <Gtk::ColorSelection> colorWheel;
		
		struct SliderWidgets
		{
			Gtk::Entry * fromEntry;
			Gtk::Entry * toEntry;
			Gtk::HScale * slider;
			SceneNodeField * field;
		};
		typedef std::map <Gtk::Entry *, SliderWidgets> sliderMap_type;
		sliderMap_type sliderMap;
		
		reseatable_reference <SceneNode> curnode;
		
		void updateValues();
		void sliderClamp(Gtk::Entry * entry);
		bool sliderMove(Gtk::ScrollType scroll, double new_value, Gtk::Entry * entry);
};

#endif
